import wx from 'weixin-js-sdk'
import Vrouter from "@/router"
const route: any = Vrouter.currentRoute.value
const router: any = Vrouter
export const backAciton: () => void = () => {
    const ua: any = navigator.userAgent.toLowerCase(); //微信小程序 
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
      wx.miniProgram.navigateBack({delta: 1})
    } else {
      if (route.query.reductName) {
        router.push({
          path: route.query.reductName
        });
      } else {
        if ((window as any).isiOS) {
          console.log("iOS返回事件");
          (window as any).webkit.messageHandlers.backAction.postMessage({});
        } else {
          console.log("安卓返回事件");
          (window as any).app.backAction();
        }
      }
    }
  }